#!/usr/bin/env bash

source /etc/profile
cd /home/marvin/sqoop-1.4.6-cdh5.6.0


mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipChannel;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipChannel --export-dir /user/hive/warehouse/res_vipchannel/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipLiveness;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipLiveness --export-dir /user/hive/warehouse/res_vipliveness/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_credits;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_credits --export-dir /user/hive/warehouse/res_credits/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_creditsRate;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_creditsRate --export-dir /user/hive/warehouse/res_creditsrate/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_rechargeb;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_rechargeb --export-dir /user/hive/warehouse/res_rechargeb --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipLiveness_cd;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipLiveness_cd --export-dir /user/hive/warehouse/res_vipliveness_cd/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_creditsRate_cd;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_creditsRate_cd --export-dir /user/hive/warehouse/res_creditsrate_cd/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_wechatmall_top;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_wechatmall_top --export-dir /user/hive/warehouse/res_wechatmall_top/ --input-fields-terminated-by ',' -m 1 --input-null-string '\\N' --input-null-non-string '\\N' --fields-terminated-by '\t'

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_wechatmall_status;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_wechatmall_status --export-dir /user/hive/warehouse/res_wechatmall_status/ --input-fields-terminated-by ',' -m 1 --input-null-string '\\N' --input-null-non-string '\\N' --fields-terminated-by '\t'

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipcoupon_ladder;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipcoupon_ladder --export-dir /user/hive/warehouse/res_vipcoupon_ladder --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipCouponRate;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipCouponRate --export-dir /user/hive/warehouse/res_vipcouponrate/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_couponTactic;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_couponTactic --export-dir /user/hive/warehouse/res_coupontactic/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipcoupon_station;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipcoupon_station --export-dir /user/hive/warehouse/res_vipcoupon_station/ --input-fields-terminated-by ',' -m 1  --input-null-string '\\N' --input-null-non-string '\\N'

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_wechatmall_topall;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_wechatmall_topall --export-dir /user/hive/warehouse/res_wechatmall_topall/ --input-fields-terminated-by ',' -m 1 --input-null-string '\\N' --input-null-non-string '\\N' --fields-terminated-by '\t'

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_evaluation;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_evaluation --export-dir /user/hive/warehouse/res_evaluation/ --input-fields-terminated-by ',' -m 1

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_coupon;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_coupon --export-dir /user/hive/warehouse/res_coupon/ --input-fields-terminated-by ',' -m 1 --input-null-string '\\N' --input-null-non-string '\\N' --fields-terminated-by '\t'

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipcoupon_source;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipcoupon_source --export-dir /user/hive/warehouse/res_vipcoupon_source/ --input-fields-terminated-by ',' -m 1 --input-null-string '\\N' --input-null-non-string '\\N' --fields-terminated-by '\t'

mysql -uroot -proot -hhadoop3 -e 'use result;truncate table res_vipcoupon_oilnotoil;'
bin/sqoop export --connect jdbc:mysql://192.168.0.34:3306/result --username root --password root --table res_vipcoupon_oilnotoil --export-dir /user/hive/warehouse/res_vipcoupon_oilnotoil/ --input-fields-terminated-by ',' -m 1 --input-null-string '\\N' --input-null-non-string '\\N' --fields-terminated-by '\t'
